package board.dao;


import java.util.HashMap;

import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;

import board.db.MybatisConfig;
import board.vo.MemberVO;

public class MemberDAO {

	SqlSessionFactory factory = MybatisConfig.getSqlSessionFactory();
	
	public MemberVO selectMember(String id) {
		SqlSession ss = null;
		MemberVO memberVO = null;
		
		try {
			ss = factory.openSession();
			memberVO = ss.selectOne("member.selectMember",id);
			
		} catch (Exception e) {
			e.printStackTrace();
		} finally{
			if(ss!=null) ss.close();
		}
		
		return memberVO;
	}
	
	public void update(MemberVO memberVO){
		SqlSession ss = null;
		
		try {
			ss = factory.openSession();
			ss.update("member.update", memberVO);
			ss.commit();
			
		} catch (Exception e) {
			e.printStackTrace();
		} finally{
			if(ss!=null) ss.close();
		}
	}
}
